package com.suse.springmvcdemo2.mapper;

import com.suse.springmvcdemo2.model.MessageInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MessageInfoMapper {

    /**
     * 添加留言
     */
    @Insert(("insert into message_info (message_info.`from`,`to`,`message`) values " +
            "(#{from},#{to},#{message})"))
    default Integer insertMessage(MessageInfo messageInfo) {
        return null;
    }

    /**
     * 查询留言
     */
    @Select("select * from message_info where delete_flag=0")
    List<MessageInfo> queryMessage();
}
